/*public class Test {
    public static int max(int a,int b){
        return a>b?a:b;
    }
    public static float max(float a,float b,float c){
        float max=a>b?a:b;
        float ret=max>c?max:c;
        return ret;
    }
    public static void main(String[] args) {
        float a=1.1f;
        float b=2.2f;
        float c=3.3f;
        System.out.println(max(a,b,c));
    }
}*/
public class Test{
    public static void Move(char pos1,char pos2){
        System.out.print(pos1+"->"+pos2+" ");
    }
    //pos1为起始位置  pos2为中转位置 pos3为目的位置
    public static void Hannuo(int n,char pos1,char pos2,char pos3){
        if(n==1){
            Move(pos1,pos3);
        }else{
            Hannuo(n-1,pos1,pos3,pos2);
            Move(pos1,pos3);
            Hannuo(n-1,pos2,pos1,pos3);
        }
    }
    public static void main(String[] args){
        Hannuo(1,'A','B','C');
        System.out.println();
        Hannuo(2,'A','B','C');
        System.out.println();
        Hannuo(3,'A','B','C');
    }
}